define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'wx.article/index',
        add_url: 'wx.article/add',
        edit_url: 'wx.article/edit',
        delete_url: 'wx.article/delete',
        export_url: 'wx.article/export',
        modify_url: 'wx.article/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},                    {field: 'id', title: 'id'},                    {field: 'pid', title: '类别ID'},                    {field: 'title', title: '文章标题'},                    {field: 'description', title: '文章摘要'},                    {field: 'author', title: '文章作者'},                    {field: 'author_email', title: '作者邮箱'},                    {field: 'keywords', title: '关键字,用逗号隔开'},                    {field: 'article_type', title: 'article_type'},                    {field: 'status', title: '是否显示,1:显示;0:不显示', templet: ea.table.switch},                    {field: 'file_url', title: '附件地址', templet: ea.table.url},                    {field: 'open_type', title: 'open_type'},                    {field: 'link', title: '链接地址'},                    {field: 'click', title: '浏览量'},                    {field: 'publish_time', title: '文章预告发布时间'},                    {field: 'sort', title: 'sort', edit: 'text'},                    {field: 'thumb', title: '文章缩略图'},                    {field: 'tags', title: 'tags'},                    {field: 'create_time', title: 'create_time'},                    {width: 250, title: '操作', templet: ea.table.tool},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});